import request from '/@/utils/request'

import {module} from '/@/api/ums'

const prefix = module + "/memberState/"

/**
 *
 * 字段控制 API
 *
 */
export function umsMemberStateApi() {

    return {
        add: (data: any): any => request({url: prefix + 'add', method: 'post', data,}),
        // edit: (data?: any): any => request({url: prefix + 'edit', method: 'put', data,}),
        // del: (data?: any): any => request({url: prefix + 'del', method: 'delete', data,}),
        query: (params: any): any => request({url: prefix + 'query', method: 'get', params}),
        batchVisible: (data: any, params: any): any => request({
            url: prefix + 'batchVisible',
            method: 'put',
            data,
            params
        }),
        prefix,
    };

}

/**
 * 获取客户字段控制列表数据,按type分组
 * 当传入指定type时, 返回该type的列表
 * 不传入时, 返回map -> {'1': [], '2': [], '3': []}
 */
export function getGroupState(type: string) {
    return request({
        url: prefix + 'getGroupState?type=' + (type || ''),
        method: 'get'
    })
}
